using System;
using System.Collections.Generic;
using ValidationFramework;

namespace ExampleLibraryCSharp
{

    public class EnumerableDuplicateRuleAttributeExample
    {
        private static readonly RuntimeMethodHandle doSomethingHandle =
            typeof(EnumerableDuplicateRuleAttributeExample).GetMethod("DoSomething").MethodHandle;

        //ErrorMessage will be generated for this attribute
        [NoDuplicateValidatorAttribute]
        //Defined ErrorMessage and InitialValue
        [NoDuplicateValidatorAttribute(ErrorMessage = "No duplicates are allowed.",
          EqualityComparerTypeName = "System.StringComparer",
          EqualityComparerPropertyName = "InvariantCulture")]
        public IList<string> Data
        {
            get;
            set;
        }

        public void DoSomething(
         [EnumerableDuplicateRule] IList<string> paramData)
        {
            ParameterValidationManager.ThrowException(this, doSomethingHandle, paramData);
        }
    }
}